package com.invengo.module_robot.ui.fragment.guide;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.Nullable;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.invengo.library_orionstar.PathBean;
import com.invengo.module_robot.BR;
import com.invengo.module_robot.R;
import com.invengo.module_robot.databinding.FragmentGuideBinding;

import java.util.List;

import me.goldze.mvvmhabit.base.BaseFragment;
import me.goldze.mvvmhabit.bus.Messenger;
import me.goldze.mvvmhabit.utils.KLog;

public class GuideFragment extends BaseFragment<FragmentGuideBinding, GuideViewModel> {
    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.fragment_guide;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }


    private String getPath() {
        String path = "";
        try {
            if (getActivity().getIntent().getExtras() != null) {
                String extras = (String) getActivity().getIntent().getExtras().get("params");
                List<PathBean> beans = new Gson().fromJson(extras, new TypeToken<List<PathBean>>() {
                }.getType());
                if (beans!=null&&!TextUtils.isEmpty(beans.get(0).getValue()))
                if (!TextUtils.isEmpty(beans.get(0).getValue())) {
                    path = beans.get(0).getValue();
                }
            } else {
                KLog.e("什么跳转数据都没有");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return path;
    }
}
